﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.TeamFoundation.WorkItemTracking.Client;

namespace Hierarchy_Maker
{
    public class Wit
    {
        public WorkItemLinkCollection WorkItemLinks { get; set; } 
         
        private readonly WorkItem _workItem;
        public Wit(WorkItem workItem)
        {
            this._workItem = workItem;

            WorkItemLinks = _workItem.WorkItemLinks;

        }

        public WorkItem WorkItem
        {
            get { return _workItem; }
        }

        public WorkItemType Type
        {
            get { return _workItem.Type; }
        }

        public override string ToString()
        {
            return _workItem.Id + "   " + _workItem.Title;
        }

        public bool Save()
        {
            try
            {
                _workItem.Save();
                return true;
            }
            catch (Exception)
            {

                return false;
            }
        }
    }
}
